package com.wushibo.adddatabackend.controller;

import com.wushibo.adddatabackend.entity.PersonInformation;
import com.wushibo.adddatabackend.mapper.PersonInforMapper;
import com.wushibo.adddatabackend.utils.Result;
import com.wushibo.adddatabackend.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/update")
@Api(value = "UpdateData Controller",tags = "更新疫情数据接口")
public class UpdatePersonInfor {
    @Autowired
    private PersonInforMapper personInforMapper;

    @ApiOperation(value="更新省级疫情数据",notes = "更新数据",httpMethod = "POST")
    @RequestMapping("/provincedata")
    public Result updateprovincedata(@RequestBody PersonInformation personInformation){
        System.out.println("后端获取数据==》"+personInformation);
        int result=personInforMapper.updateById(personInformation);
        if(result==1){
            return ResultUtil.success("疫情数据更新成功");
        }else{
            return ResultUtil.error("疫情数据更新失败");
        }
    }
}
